package org.jeecg.modules.friends.dao.impl;

import java.util.List;

import org.apache.commons.collections4.CollectionUtils;
import org.jeecg.modules.friends.condition.TradeOrderCondition;
import org.jeecg.modules.friends.mapper.ext.TradeOrderDOExtMapper;
import org.jeecg.modules.friends.model.TradeOrderDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TradeOrderDAOImpl implements org.jeecg.modules.friends.dao.TradeOrderDAO {
    @Autowired
    private TradeOrderDOExtMapper tradeOrderDOExtMapper;


    @Override
    public void insert(TradeOrderDO tradeOrderDO) {
        tradeOrderDOExtMapper.insert(tradeOrderDO);
    }

    @Override
    public TradeOrderDO queryByOid(String oid) {
        TradeOrderCondition condition = new TradeOrderCondition();
        TradeOrderCondition.Criteria criteria = condition.createCriteria();
        criteria.andOidEqualTo(oid);
        List<TradeOrderDO> tradeOrderDOList = tradeOrderDOExtMapper.selectByCondition(condition);
        return CollectionUtils.isNotEmpty(tradeOrderDOList) ? tradeOrderDOList.get(0) : null;
    }
}